{extend name='admin@public/content'}

{block name="content"}

<!-- 表单搜索 开始 -->
<form autocomplete="off" class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get">
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">微信id</label>
        <div class="layui-input-inline">
            <input name="wechat_id" value="{$Think.get.wechat_id|default=''}" placeholder="微信id" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">用户昵称</label>
        <div class="layui-input-inline">
            <input name="nickname" value="{$Think.get.nickname|default=''}" placeholder="用户昵称" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-inline">
            <select name="status" class="layui-select">
                <option value="">全部</option>
                {foreach [1 => '正常',2 =>'已删除'] as $k=>$v}
                {if $Think.get.status eq "$k"}
                <option selected="selected" value="{$k}">{$v}</option>
                {else}
                <option value="{$k}">{$v}</option>
                {/if}
                {/foreach}
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-inline">
            <input name="created_date" id="range-date" value="{$Think.get.created_date}" placeholder="请选择创建时间" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>

</form>

<script>
    window.laydate.render({range: true, elem: '#range-date'});
    window.form.render();
</script>
<!-- 表单搜索 结束 -->
<form autocomplete="off" onsubmit="return false;" data-auto="true" method="post">
    <input type="hidden" value="resort" name="action"/>
    {if empty($list)}
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    {else}
    <table class="layui-table" lay-skin="line" lay-size="sm">
        <thead>
        <tr>
            <th class='text-left'>微信ID</th>
            <th class='text-left'>用户id</th>
            <th class='text-left'>用户昵称</th>
            <th class='text-left'>状态</th>
            <th class='text-left'>创建时间</th>
            <th class='text-left'></th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $key=>$vo}
        <tr>
            <td class='text-left text-top'>{$vo.wechat_id}</td>
            <td class='text-left text-top'>{$vo.user_id}</td>
            <td class='text-left text-top'>{$vo.nickname}</td>
            <td class='text-left'>
                {if $vo.status eq 1}<span class="color-green">正常</span>{elseif $vo.status eq 2}<span class="color-red">已删除</span>{/if}

            </td>
            <td class='text-left text-top'>{$vo.created_date|date="Y-m-d H:i:s"}</td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {if isset($page)}<p>{$page|raw}</p>{/if}
    {/if}
</form>

<script>
    require(['jquery'], function () {
        // 应用创建与初始化
        $('[data-coin]').on('click', function () {
            window.location.href = "http://{:env('admin_host')}{:resultUrl('user/index')}&field=coin_balance&sort="+$(this).data('coin');
        });
        $('[data-integral]').on('click', function () {
            window.location.href = "http://{:env('admin_host')}{:resultUrl('user/index')}&field=integral&sort="+$(this).data('integral');
        });
        $('[data-money]').on('click', function () {
            window.location.href = "http://{:env('admin_host')}{:resultUrl('user/index')}&field=money_sum&sort="+$(this).data('money');
        });
        $('[data-consume]').on('click', function () {
            window.location.href = "http://{:env('admin_host')}{:resultUrl('user/index')}&field=consume_coin&sort="+$(this).data('consume');
        });
        $('[data-read]').on('click', function () {
            window.location.href = "http://{:env('admin_host')}{:resultUrl('user/index')}&field=read_coin&sort="+$(this).data('read');
        });
    });
</script>
{/block}